package com.dp.factory.simple_factory.factory;

import com.dp.factory.simple_factory.service.IFreeGoods;
import com.dp.factory.simple_factory.service.impl.DiscountFreeGoods;
import com.dp.factory.simple_factory.service.impl.SmallGiftFreeGoods;
import com.dp.factory.simple_factory.service.impl.YoukuMemberFreeGoods;

/**
 * @Author: Ruomeng
 * @Date: 2024/11/26
 * @Description : design-pattern
 * 具体工厂：生成免费商品
 * @Version: 1.0
 */
public class FreeGoodsFactory {

    public static IFreeGoods getInstance(Integer awardType) {

        IFreeGoods iFreeGoods = null;

        if (awardType.equals(1)) {
            //打折券
            iFreeGoods = new DiscountFreeGoods();
        } else if (awardType.equals(2)) {
            //Youku会员
            iFreeGoods = new YoukuMemberFreeGoods();
        } else if (awardType.equals(3)) {
            //小礼品
            iFreeGoods = new SmallGiftFreeGoods();
        }
        return iFreeGoods;
    }
}
